package LessonUI;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JButton;
import javax.swing.JPanel;

import vo.LessonVO;
import vo.TeacherVO;

public class MainViewLesson extends JPanel
{
	TeacherVO teacher;
	LessonSelect ls;
	LessonDetail ld;
	
	JButton save;
	
	public MainViewLesson(TeacherVO user)
	{
		super();
		setOpaque(false);
		setSize(1280,725*4/5);
		setVisible(true);
		setLayout(null);
		
		ls = new LessonSelect();
		ld = new LessonDetail();
		
		this.add(ls);
		ls.setBounds(0, 0,512,580);
		ls.setVisible(true);
		
		this.add(ld);
		ld.setBounds(512,0,700,580);
		ld.setVisible(true);
		
		teacher=user;
		setLessonSelect();
		setLessonDetail();
		repaint();
	}
	

	
	private void setLessonDetail()
	{
		ld.setUnchange();
	}
	
	private void setLessonSelect()
	{
		ls.table.addMouseListener(new tableListener());
	}
	
	public class tableListener implements MouseListener
	{
		public void mouseClicked(MouseEvent arg0)
		{
			int number = ls.table.getSelectedRow();
			LessonVO aim = ls.list.get(number);
			ld.showLesson(aim);
		}

		public void mouseEntered(MouseEvent arg0)
		{
		}

		public void mouseExited(MouseEvent arg0)
		{
		}

		public void mousePressed(MouseEvent arg0)
		{
		}

		public void mouseReleased(MouseEvent arg0)
		{
		}
	}
}
